package org.gemini.transport.payload;


/**
 * 消息体bytes/stream载体, 避免在IO线程中序列化/反序列化, jupiter-transport这一层不关注消息体的对象结构.
 * @author hailin.zhl
 */
public abstract class PayloadHolder {

    private byte[] bytes;

    public byte[] bytes() {
        return bytes;
    }

    public void bytes(byte[] bytes) {
        this.bytes = bytes;
    }

    // help gc
    public void clear() {
        bytes = null;
    }

    public int size() {
        return bytes == null ? 0 : bytes.length;
    }
}
